select

Purpose

Helper tag for creating select component, same as the grails' select tag:

Examples

// create a select from a range
<z:select name="user.age" from="${18..65}" value="${age}"
          noSelection="['':'-Choose your age-']"/>
// use a no selection with a nullable Object property (use 'null' as key)
 <z:select id="type" name='type.id' value="${person?.type?.id}"
    noSelection="${['null':'Select One...']}"
    from='${PersonType.list()}'
    optionKey="id" optionValue="name"/>

// create select from a list of companies // note the 'optionKey' is set to the id of each company element <z:select name="user.company.id" from="${Company.list()}" value="${user?.company.id}" optionKey="id" />

// create multiple select <z:select name="cars" from="${Car.list()}" value="${person?.cars*.id}" optionKey="id" multiple="true" />

// create select with internationalized labels (this is useful for small static lists and the inList constraint) // expected properties in messages.properties: // book.category.M=Mystery // book.category.T=Thriller // book.category.F=Fantasy <z:select name="book.category" from="${['M', 'T', 'F']}" valueMessagePrefix="book.category" />

Description

Attributes